﻿<%@ Control Language="C#" ClassName="Servey" %>

<style>
    .ThamDoYKienDetail{color:#666}
 .ThamDoYKienDetail .title{font-weight:bold;}
 .ThamDoYKienDetail span{clear:both; line-height:20px; vertical-align:middle; width:200px; display:block; padding-left:5px; clear: both;float: none;}
 .ThamDoYKienDetail span input{height:20px; margin-left:20px; margin-right:5px;float: left;}
 .ThamDoYKienDetail span label{line-height:20px;display: block;float: left;width: 140px; cursor:pointer;}
 
 .ThamDoYKienDetail span a{ margin-top:5px; margin-bottom:5px; float:left;height: 20px;line-height: 19px;display: block;background-color: #79AD36;position: relative;color: #F0F0F0;font-weight: bold; font-size:11px; text-align:center;}
 #btnSendServey{width:50px; margin-left: 10px; margin-right: 16px;}
 #btnViewServey{width:100px;}
</style>
<div class="ThamDoYKien">
    <div class="ThamDoYKienHeader">
        <a id='poll'></a>
    </div>
    <div class="ThamDoYKienDetail">
        
        
        <span class='title'><asp:Literal ID="ltrTitle" runat="server" /></span>
        <asp:Literal ID="ltrAns" runat="server" />
        
        <span><a id="btnSendServey">Gửi</a> <a id="btnViewServey">Xem kết quả</a> </span>
    </div>
    <div class="ThamDoYKienFooter">
    </div>
</div>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string type = "checkbox";
            string Lang = Session["Lang"] == null ? hachiCookies.getCookieValue("Lang") : Session["Lang"].ToString();
            Hachi.Controllers.ServeyController sctr = new Hachi.Controllers.ServeyController();
            hachiModel.SV_Question q = sctr.QuestionGet();
            hachiModel.SV_QuestionDetail qd = sctr.QuestionDetailGet(q, Lang);
            if (!q.IsMultiChoose) type = "radio";

            ltrTitle.Text = qd.Question;
            foreach (var item in sctr.AnswerGet(q))
            {
                ltrAns.Text += "<span><input name='servey' id='sAns" + item.AnswerID + "' type='" + type + "' value='" + item.AnswerID + "' /><label for='sAns" + item.AnswerID + "'>" + sctr.AnswerDetailGet(item, Lang).Answer + "</label></span>";
            }
        }

    }
</script>
